Fix Sell Max showing entered fiat value in crypto field - #6107
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
📸🩹 Test evidence — Sell Max fix (iOS sim)
sellmax crypto is max not fiat 🩹 HACK-FORCED: fixed window crypto not fiat 🩹 HACK-FORCED: BUGREPRO old ordering fiat in crypto Captured by the agent's in-app test run (build-and-test). |
b16284c to
26d6272
Compare
26d6272 to
3b1202a
Compare
3b1202a to
8313d7a
Compare
There was a problem hiding this comment.
Claude Code Review
Claude Code Review is paused for this repository. To reconnect it, an admin of this repository's GitHub organization (or the account owner, for personal repositories) who can also manage your Claude organization's Code Review settings needs to re-link GitHub in Code Review settings. This is a one-time step.
Tip: disable this comment in your organization's Code Review settings.
8313d7a to
fca9989
Compare
Pull request was closed
fca9989 to
16292d1
Compare
2d3b0b7 to
625495a
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 625495a. Configure here.
Tapping Max on the Sell scene flipped lastUsedInput to 'crypto' before the async max calculation finished, while amountQuery still held the previously entered fiat amount. displayCryptoAmount then rendered that fiat value in the crypto field (e.g. 100 USD shown as 100 BTC) until the max resolved. Set the max amount query before flipping the input type so the display always shows the computed max.
625495a to
8b35794
Compare
📸🪓 Test evidence — post-fix re-verification (iOS sim, edge-funds My Ether 4)
sellmax happy crypto not fiat 🪓 HACK-FORCED: f1 type during max not clobbered 🪓 HACK-FORCED: f3 max error recovers Captured by the agent's in-app test run (build-and-test). |







CHANGELOG
Does this branch warrant an entry to the CHANGELOG?
Dependencies
none
Requirements
If you have made any visual changes to the GUI. Make sure you have:
Description
Fixes the Sell scene "Max" bug where the previously entered fiat amount was momentarily copied into the crypto field (e.g. entering
100USD, then tapping Max, showed100in the crypto field before the real max resolved).Root cause is in
handleMaxPressinRampCreateScene.tsx. On the sell path it flippedlastUsedInputto'crypto'before awaiting the async max calculation, whileamountQuerystill held the previously entered fiat value{ exchangeAmount: '100' }. During that async gapdisplayCryptoAmounttook itslastUsedInput === 'crypto'branch and returnedamountQuery.exchangeAmount(the fiat number), so the crypto field rendered the fiat value. On large wallets the max calculation (getMaxSpendable) is slow, so the wrong value lingered and routing stalled.The fix sets the max amount query before flipping the input type (and no longer flips it before the await), so the display memos take their max branch immediately and the crypto field only ever shows the computed max. Buy is unchanged (its branch has no await, so its state updates already batch).
Hardening around the same async max window (added while addressing review rounds, all folded into the one commit):
cancelPendingMaxhelper (bumps a monotonic request id, clears the pending auto-nav and the computing spinner), so a late-resolving max cannot overwrite the typed amount or auto-navigate on it.withPickerOpen/showPickerModal), so a max quote resolving mid-selection cannot navigate out from under the modal; the max keeps computing and navigates once the picker closes.Asana: https://app.asana.com/0/1215088146871429/1215965639107175
Testing (iOS sim, edge-funds, My Ether 4 / ETH, Sell scene):
Note
Medium Risk
Changes ramp sell amount state, async max spendable, and auto-navigation timing in
RampCreateScene; mistakes could affect quote routing or leave the UI stuck, but scope is limited to the ramp create flow.Overview
Fixes the Sell scene Max bug where the previously entered fiat amount briefly appeared in the crypto field while max spendable was still computing.
handleMaxPresson sell now clears the amount, defers settinglastUsedInputto'crypto'until aftergetMaxSpendExchangeAmountcompletes, and applies the max query first on buy so display memos use the max branch instead of treating stale fiat as crypto.Adds
cancelPendingMax(monotonic request id),withPickerOpen/showPickerModalso auto-nav after Max does not fire while wallet/fiat/region pickers are open, spinner + disabled Max during compute, error handling viashowError, and cancels in-flight max on manual edits, wallet/fiat changes (with correct comparison to displayed fiat), and overlapping Max taps.Reviewed by Cursor Bugbot for commit 8b35794. Bugbot is set up for automated code reviews on this repo. Configure here.